home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00382_Mode Manager.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  7.7 KB  |  308 lines

  1. global gModeState, gGlobalStepCount, gLocalStepCount, gAlphaState, oINTERfaceUpdate, gSearchState, oIndexMediator, gFTsearchscope, gCHROisScrolling, gDefaultBar1, gDefaultBar2, oINTERfaceFind, gExtraSpeed, gSpeedResources, oIndexScroller, oIndexSlider, oTextScroller, oHelpRoll, gPuppetStorage, gVisiList, gImInHelp, gPDL, gTopicBase, gActiveResTopWin, gthumbn1spr, gthumbn5spr, oTextSlider, gIndxScrollFldK, gTheFTword, oVidCD, oImport, oTopicControl, gHoldSearchInfo, gInputFieldSpr, gOurFontK, gSavedMouseUpScript, gFindBase, gSavedMouseUpScriptforhelp, gPlaying, gPlayAll
  2.  
  3. on hInitMode
  4.   set gModeState to #ENCY
  5.   set gSearchState to #ENTRY
  6. end
  7.  
  8. on hSetMode pTowhat
  9.   if pTowhat <> gModeState then
  10.     hputmsg(">hSetMode: ‚Ä¢ to" && pTowhat && "in frame " & the frame)
  11.     hSayProgress(#ACC)
  12.     set the mouseDownScript to "hMouseEventSupervisor"
  13.     set the mouseUpScript to gSavedMouseUpScript
  14.     hCallHltModes(pTowhat)
  15.     set gCHROisScrolling to 0
  16.     set the visible of sprite gTopicBase to 0
  17.     set vLeavingTopics to gModeState = #TOPICS
  18.     if pTowhat = #ENCY then
  19.       set gTheFTword to EMPTY
  20.     end if
  21.     mClearCanProButts(oVidCD)
  22.     hCallClear()
  23.     set gModeState to pTowhat
  24.     hSetGlobalCounter(1)
  25.     hSetAlphaState(EMPTY)
  26.     hUpdateWin()
  27.     hResetMediaButts()
  28.     hFlushPriorParamsNEW()
  29.     go(label(string(gModeState)) + 1)
  30.     hSetupThumbs()
  31.     mCheckHeader(oINTERfaceFind)
  32.     mHomeTxtScroll(oTextScroller)
  33.     if vLeavingTopics then
  34.       mShowTopicVisibles(oTopicControl)
  35.     end if
  36.     mReDefineSlider(oIndexSlider, 1, mGetModesMaxEntryNum(oIndexMediator) - 6, 1)
  37.   end if
  38.   if gModeState = #FoundSet then
  39.     mPrepScrollStats(oTextScroller)
  40.     set Lbutnum to hMatchButtToType(mWhatFSlistType(oIndexScroller))
  41.     mHltfromScripts(oINTERfaceUpdate, Lbutnum)
  42.   end if
  43.   mNudgeSlider(oIndexSlider, 0)
  44. end
  45.  
  46. on hMatchButtToType pType
  47.   if (pType = 0) or (pType = 1) then
  48.     return 2
  49.   else
  50.     if pType = 2 then
  51.       return 1
  52.     else
  53.       if pType = 3 then
  54.         return 1
  55.       end if
  56.     end if
  57.   end if
  58. end
  59.  
  60. on hFlushPriorParams
  61.   mClearIndexParams(oIndexScroller)
  62.   mUpdateIndexParams(oIndexMediator)
  63.   hPurgeMedia()
  64. end
  65.  
  66. on hFlushPriorParamsNEW
  67.   mClearIndexParams(oIndexScroller)
  68.   mUpdateIndexParams(oIndexMediator)
  69. end
  70.  
  71. on hSwitchScopeStuff pCode, pValue
  72.   if pCode = 22 then
  73.     hSwitchFTsearchscope(pValue)
  74.   else
  75.     if pCode = 14 then
  76.       hSwitchSearchState(pValue)
  77.     end if
  78.   end if
  79. end
  80.  
  81. on hSwitchFTsearchscope pSomeThing
  82.   if symbolp(pSomeThing) then
  83.     if not (pSomeThing = #FoundSet) then
  84.       set gFTsearchscope to pSomeThing
  85.     end if
  86.     if pSomeThing = #EPISSUB then
  87.       set gFTsearchscope to #EPIS
  88.     end if
  89.   else
  90.     if pSomeThing = 1 then
  91.       set gFTsearchscope to #ENCY
  92.     else
  93.       if pSomeThing = 2 then
  94.         set gFTsearchscope to #EPIS
  95.       else
  96.         if pSomeThing = 3 then
  97.           set gFTsearchscope to #CHRO
  98.         else
  99.           if pSomeThing = 4 then
  100.             set gFTsearchscope to #ALL
  101.           else
  102.             if pSomeThing = 5 then
  103.               set gFTsearchscope to #FoundSet
  104.             end if
  105.           end if
  106.         end if
  107.       end if
  108.     end if
  109.   end if
  110. end
  111.  
  112. on hSwitchSearchState pWhat
  113.   if pWhat = 1 then
  114.     set gSearchState to #ENTRY
  115.   else
  116.     set gSearchState to #word
  117.   end if
  118. end
  119.  
  120. on hSetAlphaState pTowhat
  121.   if pTowhat <> gAlphaState then
  122.     set gAlphaState to pTowhat
  123.   else
  124.   end if
  125. end
  126.  
  127. on hResetResMode
  128.   global gAssetPath
  129.   set the fileName of cast the number of cast "BlankM.DIR" to the pathName & "BL" & gPDL & "BlankM.DIR"
  130. end
  131.  
  132. on hHideThumbs
  133.   repeat with x = gthumbn1spr to gthumbn5spr
  134.     set the visible of sprite x to 0
  135.   end repeat
  136.   updateStage()
  137. end
  138.  
  139. on hReVisThumbs
  140.   repeat with x = gthumbn1spr to gthumbn5spr
  141.     set the visible of sprite x to 1
  142.   end repeat
  143.   updateStage()
  144. end
  145.  
  146. on hGoHelp
  147.   puppetSprite(18, 0)
  148.   set gSavedMouseUpScript to the mouseUpScript
  149.   set the mouseUpScript to EMPTY
  150.   set gImInHelp to 1
  151.   hHelpWinClose()
  152.   hStoreLockWins()
  153.   if gHoldSearchInfo = 1 then
  154.     set the editableText of sprite gInputFieldSpr to 0
  155.   end if
  156.   set gSavedMouseUpScriptforhelp to the keyDownScript
  157.   set the keyDownScript to EMPTY
  158.   hAnnounce("On line help")
  159.   hStorePuppets()
  160.   hStoreVisibles()
  161.   set the textStyle of field "HelpIndex" to "plain"
  162.   set the textStyle of line 1 of field "HelpIndex" to "Bold"
  163.   go("Help0")
  164.   mSetHelpMode(oHelpRoll, gModeState)
  165. end
  166.  
  167. on hLeaveHelp
  168.   set gImInHelp to 0
  169.   hClearPuppets()
  170.   if the soundBusy of 1 then
  171.     puppetSound(0)
  172.   end if
  173.   set the visible of sprite 39 to 1
  174.   go(label(string(gModeState)))
  175.   hRestorePuppets()
  176.   hRestoreVisibles()
  177.   if gModeState <> #TOPICS then
  178.     hRestoreLockWins()
  179.   end if
  180.   if gHoldSearchInfo = 1 then
  181.     set the editableText of sprite gInputFieldSpr to 1
  182.   end if
  183.   set the keyDownScript to gSavedMouseUpScriptforhelp
  184. end
  185.  
  186. on hClearPuppets
  187.   repeat with x = 1 to 48
  188.     if the puppet of sprite x then
  189.       puppetSprite(x, 0)
  190.     end if
  191.   end repeat
  192. end
  193.  
  194. on hStorePuppets
  195.   set gPuppetStorage to [:]
  196.   repeat with x = 1 to 48
  197.     if the puppet of sprite x then
  198.       set vPuppetdata to list(the castNum of sprite x, the locH of sprite x, the locV of sprite x)
  199.       addProp(gPuppetStorage, x, vPuppetdata)
  200.       puppetSprite(x, 0)
  201.     end if
  202.   end repeat
  203.   updateStage()
  204. end
  205.  
  206. on hRestorePuppets
  207.   set vListlen to count(gPuppetStorage)
  208.   if vListlen then
  209.     repeat with x = 1 to vListlen
  210.       set vSprite to getPropAt(gPuppetStorage, x)
  211.       puppetSprite(vSprite, 1)
  212.       set vPuppetdata to getAt(gPuppetStorage, x)
  213.       set the castNum of sprite vSprite to getAt(vPuppetdata, 1)
  214.       set the locH of sprite vSprite to getAt(vPuppetdata, 2)
  215.       set the locV of sprite vSprite to getAt(vPuppetdata, 3)
  216.     end repeat
  217.     updateStage()
  218.   end if
  219.   if gHoldSearchInfo = 1 then
  220.     set the editableText of sprite gInputFieldSpr to 1
  221.   end if
  222. end
  223.  
  224. on hStoreVisibles
  225.   set gVisiList to []
  226.   repeat with x = 1 to 48
  227.     if not (the visible of sprite x) then
  228.       add(gVisiList, x)
  229.       set the visible of sprite x to 1
  230.     end if
  231.   end repeat
  232.   updateStage()
  233. end
  234.  
  235. on hRestoreVisibles
  236.   set vListlen to count(gVisiList)
  237.   if vListlen then
  238.     repeat with x = 1 to vListlen
  239.       set the visible of sprite getAt(gVisiList, x) to 1
  240.       updateStage()
  241.     end repeat
  242.   end if
  243. end
  244.  
  245. on hTrapPlayback
  246.   if the clickOn <> gFindBase then
  247.     go(label("RESOURCES"))
  248.   else
  249.     return 
  250.   end if
  251. end
  252.  
  253. on hGoTopicEdit
  254.   set gSavedMouseUpScript to the mouseUpScript
  255.   set the mouseUpScript to EMPTY
  256.   hHelpWinClose()
  257.   hStoreLockWins()
  258.   if gModeState = #TOPICS then
  259.     if string(the windowList) contains gActiveResTopWin then
  260.       hCloseTopWin()
  261.       forget(window gActiveResTopWin)
  262.     end if
  263.     set the visible of sprite gTopicBase to 0
  264.     mClearTopHlt(oINTERfaceTopicControl)
  265.   end if
  266.   if gHoldSearchInfo = 1 then
  267.     set the editableText of sprite gInputFieldSpr to 0
  268.   end if
  269.   set gSavedMouseUpScriptforhelp to the keyDownScript
  270.   set the keyDownScript to EMPTY
  271.   if gModeState = #Resources then
  272.     hResetResMode()
  273.   end if
  274.   hStorePuppets()
  275.   hStoreVisibles()
  276.   mReport(oImport, "Preparing...")
  277.   go("TopicEditStart")
  278. end
  279.  
  280. on hLeaveTopicEdit
  281.   hClearPuppets()
  282.   if the soundBusy of 1 then
  283.     puppetSound(0)
  284.   end if
  285.   mReport(oImport, "Resuming main program...")
  286.   go(label(string(gModeState)))
  287.   hRestorePuppets()
  288.   repeat with x = 21 to 24
  289.     set the visible of sprite x to 1
  290.   end repeat
  291.   hRestoreVisibles()
  292.   if gModeState <> #TOPICS then
  293.     hRestoreLockWins()
  294.   end if
  295.   if gHoldSearchInfo = 1 then
  296.     set the editableText of sprite gInputFieldSpr to 1
  297.   end if
  298.   set the keyDownScript to gSavedMouseUpScriptforhelp
  299.   if (gModeState = #TOPICS) or (gModeState = #Resources) then
  300.     if gModeState = #TOPICS then
  301.       mGetPage(oIndexScroller)
  302.       hRecall(#TOPICS)
  303.     end if
  304.     set the mouseUpScript to gSavedMouseUpScript
  305.     set gSavedMouseUpScript to EMPTY
  306.   end if
  307. end
  308.